/**
 * @description  : 布局-页签组件
 * @descriptionDetail : 布局-页签组件
 * @copyright    : 浙江烟草
 * @author       : zx
 * @create       : 2022-12-05 10:30:56
 */
<template>
  <view class="page">
    <!-- #ifdef H5-ONLY -->
    <!-- 零售户查询功能中，查询条件中档位查询可选多个档位需要改成单选，档位选择框点确定后弹窗不能自动消失 找祝肖  2024-4-17   start-->
    <theme-navbar :is-white="false" backText="返回" :title="personTitle" :custom-back="goBack">
      <view class="nav-right-icon">
        <!-- <u-icon name="list" color="#FFF" size="38" style="margin: 0 14rpx 0 6rpx" @tap="orgShow = true"></u-icon> -->
      </view>
    </theme-navbar>
    <!-- #endif -->
    <view class="rdcontent">
      <u-form :model="layoutForm" :rules="rules" ref="uForm">
        <u-row gutter="16" align="top" class="divided-line">
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="人员类型" :required="true" prop="personType">
              <!-- <dic-input  :keyWord="$u.dic.DIC_KEYS.L_PERSON_TYPE" :dicCode="layoutForm.personType" inputAlign="left" type="select" :select-open="
              dicSelectOpen('personType', $u.dic.DIC_KEYS.L_PERSON_TYPE)
            " placeholder="请选择" v-model="layoutForm.personTypeName" @changeInputModelData="
              (name) => {
                $set(layoutForm, 'personTypeName', name);
              }
            " @click="
              !isDisabled && showDic(
                $u.dic.DIC_KEYS.L_PERSON_TYPE,
                layoutForm.personType,
                'personType'
              )
            " /> -->
                <u-input :border="false" type="select" :disabled="true" :select-open="typeShow" placeholder="请选择" v-model="layoutForm.personTypeName" @click="isAdd&&peopleTypeShow()"></u-input>
                <u-select v-if="isAdd==true" mode="single-column" label-name="text" :list="typeList" v-model="typeShow" @confirm="selectTypeConfirm($event)" ></u-select>
                
            
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="姓名" :required="true">
              <u-input placeholder="请输入" v-model="layoutForm.personName" :disabled="isDisabled" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="与持证人关系" :required="true" prop="relationship">
              <dic-input  :keyWord="$u.dic.DIC_KEYS.L_RELATIONSHIP" :dicCode="layoutForm.relationship" inputAlign="left" type="select" :select-open="
              dicSelectOpen('relationship', $u.dic.DIC_KEYS.L_RELATIONSHIP)
            " placeholder="请选择" v-model="layoutForm.relationshipName" @changeInputModelData="
              (name) => {
                $set(layoutForm, 'relationshipName', name);
              }
            " @click="
              !isDisabled&&showDic(
                $u.dic.DIC_KEYS.L_RELATIONSHIP,
                layoutForm.relationship,
                'relationship'
              )
            " />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="性别" :required="true" prop="personGender">
              <dic-input :keyWord="$u.dic.DIC_KEYS.BSC_GENDDER" :dicCode="layoutForm.personGender" inputAlign="left" type="select" :select-open="
              dicSelectOpen('personGender', $u.dic.DIC_KEYS.BSC_GENDDER)
            " placeholder="请选择" v-model="layoutForm.personGenderName" @changeInputModelData="
              (name) => {
                $set(layoutForm, 'personGenderName', name);
              }
            " @click="
              showDic(
                $u.dic.DIC_KEYS.BSC_GENDDER,
                layoutForm.personGender,
                'personGender'
              )
            " />
            </u-form-item>
          </u-col>
          <u-col span="12" v-if="!isShow">
            <u-form-item :label-position="labelPosition" label="籍贯" prop="personLocal">
              <u-input type="text" placeholder="请选择" :disabled="true" :custom-style="pointerStyle" v-model="layoutForm.personLocal" @click="showArea(1)"></u-input>
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="证件类型" :required="true" prop="credType">
              <dic-input  :keyWord="$u.dic.DIC_KEYS.L_PIC_CID_TYPE" :dicCode="layoutForm.credType" inputAlign="left" type="select" :select-open="
              dicSelectOpen('credType', $u.dic.DIC_KEYS.L_PIC_CID_TYPE)
            " placeholder="请选择" v-model="layoutForm.credTypeName" @changeInputModelData="
              (name) => {
                $set(layoutForm, 'credTypeName', name);
              }
            " @click="
              !isDisabled&&showDic(
                $u.dic.DIC_KEYS.L_PIC_CID_TYPE,
                layoutForm.credType,
                'credType'
              )
            " />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="证件号码" :required="true" prop="credNum">
              <u-input placeholder="请输入" :disabled="isDisabled" v-model="layoutForm.credNum" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="证件登记住址" :required="true" prop="credAddr">
              <u-input placeholder="请输入" v-model="layoutForm.credAddr" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="现住址" prop="currentAddr">
              <u-input placeholder="请输入" v-model="layoutForm.currentAddr" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="手机号码" :required="true" prop="contactMobile">
              <u-input placeholder="请输入" v-model="layoutForm.contactMobile" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="座机号码" prop="contactLine">
              <u-input placeholder="请输入" v-model="layoutForm.contactLine" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="政治面貌" prop="politicsStatus">
              <dic-input :keyWord="$u.dic.DIC_KEYS.T_PERSON_POLITICS" :dicCode="layoutForm.politicsStatus" inputAlign="left" type="select" :select-open="
              dicSelectOpen('politicsStatus', $u.dic.DIC_KEYS.T_PERSON_POLITICS)
            " placeholder="请选择" v-model="layoutForm.politicsStatusName" @changeInputModelData="
              (name) => {
                $set(layoutForm, 'politicsStatusName', name);
              }
            " @click="
              showDic(
                $u.dic.DIC_KEYS.T_PERSON_POLITICS,
                layoutForm.politicsStatus,
                'politicsStatus'
              )
            " />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item label="文化程度" :label-position="labelPosition" prop="eduLevel">
              <dic-input :keyWord="$u.dic.DIC_KEYS.L_EDU_LEVEL" :dicCode="layoutForm.eduLevel" inputAlign="left" type="select" :select-open="
              dicSelectOpen('eduLevel', $u.dic.DIC_KEYS.L_EDU_LEVEL)
            " placeholder="请选择" v-model="layoutForm.eduLevelName" @changeInputModelData="
              (name) => {
                $set(layoutForm, 'eduLevelName', name);
              }
            " @click="
              showDic(
                $u.dic.DIC_KEYS.L_EDU_LEVEL,
                layoutForm.eduLevel,
                'eduLevel'
              )
            " />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="出生年月" right-icon="arrow-right">
              <u-input placeholder="请选择" input-align="left" v-model="layoutForm.birthDate" @click="clicDatekHandle('birthDate')" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="民族" prop="personNative">
              <dic-input :keyWord="$u.dic.DIC_KEYS.NATION_LIST" :dicCode="layoutForm.personNative" inputAlign="left" type="select" :select-open="
              dicSelectOpen('personNative', $u.dic.DIC_KEYS.NATION_LIST)
            " placeholder="请选择" v-model="layoutForm.personNativeName" @changeInputModelData="
              (name) => {
                $set(layoutForm, 'personNativeName', name);
              }
            " @click="
              showDic(
                $u.dic.DIC_KEYS.NATION_LIST,
                layoutForm.personNative,
                'personNative'
              )
            " />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="QQ号" prop="qqAccount">
              <u-input placeholder="请输入" v-model="layoutForm.qqAccount" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="微信号" prop="wechatAccount">
              <u-input placeholder="请输入" v-model="layoutForm.wechatAccount" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="支付宝账号" prop="alipayAccount">
              <u-input placeholder="请输入" v-model="layoutForm.alipayAccount" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="车辆信息" prop="vehicleInfo">
              <u-input placeholder="请输入" v-model="layoutForm.vehicleInfo" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="电子邮箱" prop="emailAccount">
              <u-input placeholder="请输入" v-model="layoutForm.emailAccount" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="宗教信仰" prop="religion">
              <u-input placeholder="请输入" v-model="layoutForm.religion" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="家庭情况" prop="homeInfo">
              <u-input placeholder="请输入" v-model="layoutForm.homeInfo" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="个人爱好" prop="hobby">
              <u-input placeholder="请输入" v-model="layoutForm.hobby" />
            </u-form-item>
          </u-col>
          <u-col span="12">
            <u-form-item :label-position="labelPosition" label="健康状况" prop="health">
              <u-input placeholder="请输入" v-model="layoutForm.health" />
            </u-form-item>
          </u-col>
        </u-row>
      </u-form>
      <view class="popup-submit-btns">
        <u-button class="u-btn" type="primary" @click="submitLngLat('01')">保存</u-button>
        <!-- <u-button class="u-btn" type="primary" @click="submitLngLat('02')">提交</u-button> -->
      </view>
    </view>
    <u-calendar :mode="mode" :max-date="yestDate" v-model="birthDate" @change="changeDate('birthDate',$event)">
    </u-calendar>
    <dic-choice :keyWord="dicKeyWords" :currentSelect="dicCurrentSelect" v-model="dicShow" @confirm="selectDicConfirm"></dic-choice>
    <!-- 行政区划选择 -->
    <u-popup mode="bottom" height="80%" v-model="areaShow">
      <area-select @choose="nativeNameSelectShowComfir"></area-select>
    </u-popup>
  </view>
</template>

<script>
import { dateUtils } from "@/common/util";
import DicInput from "@/components/dic_input.vue";
import DicChoice from "@/components/dic_choice.vue";
import areaSelect from "@/components/area-select.vue";
// import certificateService from '@/service/certificate/certificate.service'
// import fsection from "@/components/form-section.vue";
// import { AMapMixin } from "@/common/AMapMixin.js";
import commonService from "@/service/common/common.service";
import certificateService from "@/service/certificate/certificate.service.js";
export default {
  components: {
    // fsection
    DicInput,
    DicChoice,
    areaSelect
  },
  //   mixins: [AMapMixin],
  props: {
    //  personUuid: {
    //   default: '',
    //   type:String,
    // },
    // isDisabled: {
    //   default: false,
    //   type:Boolean,
    // },
  },
  // 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
  onReady() {
    this.$refs.uForm.setRules(this.rules);
  },
  onLoad(options) {
    let obj = this.getRouteParam();
    this.layoutForm.retailerUuid=obj.retailerUuid
    this.isAdd=obj.isAdd;
    if (obj.personUuid) {
      this.personUuid = obj.personUuid;
      this.personTitle='人员信息编辑'
      
      this.isDisabled = obj.isDisabled;
      this.getPersonDetail();
    } else {
      this.isShow = false;
    }
  },
  data() {
    return {
      isAdd:false,
      typeShow:false,
      isShow: true,
      mode: "date",
      yestDate: this.$u.timeFormat(Date.now()),
      birthDate: false,
      title: {
        basemsg: "布局信息"
      },
      isDisabled: false,
      personUuid: "",
      basemsg: {},
      markers: [],
      personTitle:'人员信息新增',
      lonLat: "/",
      leaseTime: "/",
      orgName: "",
      layoutForm: {
        alipayAccount: "", // 支付宝账号【可多个逗号隔开】
        birthDate: "", // 出生年月
        contactLine: "", // 联系电话（座机）【可多个逗号隔开】
        contactMobile: "", // 联系电话（手机）【可多个逗号隔开】
        credAddr: "", // 身份证地址
        credNum: "", // 证件号码
        credType: "", // 证件类型
        currentAddr: "", // 当前住址
        eduLevel: "", // 文化程度
        emailAccount: "", // E-mail【可多个逗号隔开】
        health: "", // 健康状况
        hobby: "", // 个人爱好
        homeInfo: "", // 家庭状况
        personGender: "", // 性别
        personLocal: "", // 户籍所在地
        personLocalCode: "",
        personName: "", // 人员姓名
        personNative: "", // 民族
        personType: "", // 人员类型
        personTypeName: "", // 人员类型
        politicsStatus: "", // 证照面貌
        qqAccount: "", // QQ号【可多个逗号隔开】
        relationship: "", // 与持证人关系
        religion: "", // 宗教信仰
        vehicleInfo: "", // 车辆信息标识【可多个逗号隔开】
        wechatAccount: "", // 微信号【可多个逗号隔开】
        personUuid: "",
        retailerUuid: "",
        subjectType: ""
      },
      // L_PERSON_TYPE: this.$u.dic.getDicByKeyCode(this.$u.dic.DIC_KEYS.L_PERSON_TYPE).filter(item=>item.bcbCode!=='01'),
      // L_PERSON_TYPE: this.$u.dic.DIC_KEYS.L_PERSON_TYPE.filter(item=>item.bcbCode!=='01'),
      labelPosition: "top",
      dicShow: false,
      dicCurrentSelect: "",
      dicKeyWords: "",
      mode: "date",
      type: "",
      areaShow: false,
      pointerStyle: {
        marginRight: "5px",
        pointerEvents: "none !important"
      },
      yestDate: this.$u.timeFormat(Date.now()),
      leaseTimelimitStart: false,
      leaseTimelimitEnd: false,
      typeList:[ {
            "bcbId": "00000000000004783695393680555961",
            "bctPhName": "L_PERSON_TYPE",
            "bctName": "人员类型",
            "value": "02",
            "bcbPhName": "MANAGER",
            "text": "经营人(业务)",
        },
        {
            "bcbId": "00000000000004783695393680555962",
            "bctPhName": "L_PERSON_TYPE",
            "bctName": "人员类型",
            "value": "03",
            "bcbPhName": "EMPLOYEE",
            "text": "从业人员",
        },
        {
            "bcbId": "00000000000004783695393680555963",
            "bctPhName": "L_PERSON_TYPE",
            "bctName": "人员类型",
            "value": "04",
            "bcbPhName": "AGENT",
            "text": "代理人",
        },
        {
            "bcbId": "00000000000004783695393680555964",
            "bctPhName": "L_PERSON_TYPE",
            "bctName": "人员类型",
            "value": "05",
            "bcbPhName": "SUSPECTS",
            "text": "借证嫌疑人",
        },
        {
            "bcbId": "00000000000004783695393680555965",
            "bctPhName": "L_PERSON_TYPE",
            "bctName": "人员类型",
            "value": "06",
            "bcbPhName": "FAMILY",
            "text": "家庭成员",
        },],
        rules1: {
        // personType: [
        //   {
        //     required: true,
        //     message: "请选择人员类型",
        //     trigger: ["change", "blur"]
        //   }
        // ],
        // personName: [
        //   {
        //     max: 15,
        //     message: "您输入的内容过长！",
        //     trigger: ["change", "blur"]
        //   }
        // ],
        personLocalCode: [
          {
            // required: true,
            validator: () => {
              return !!this.layoutForm.personLocalCode.length;
            },
            message: "请选择籍贯！"
            // trigger: ["change", "blur"]
          }
        ],
        personGender: [
          {
            required: true,
            message: "请选择性别！",
            trigger: ["change", "blur"]
          }
        ],
        relationship: [],
        credType: [],
        credNum: [],
        credAddr: [
          {
            required: true,
            message: "请填写证件登记住址！",
            trigger: ["change", "blur"]
          },
          {
            max: 60,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        currentAddr: [
          {
            // required: true,
            message: "请填写现住址！",
            trigger: ["change", "blur"]
          },
          {
            max: 60,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        contactMobile: [
          {
            required: true,
            message: "请填写联系电话！",
            trigger: ["change", "blur"]
          }
          //   { pattern: this.Rules.phoneOrTel, message: "请输入正确的联系电话" }
        ],
        contactLine: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        personNative: [
          { max: 8, message: "您输入的内容过长！", trigger: ["change", "blur"] }
        ],
        politicsStatus: [
          {
            // required: true,
            message: "请选择政治面貌！",
            trigger: ["change", "blur"]
          }
        ],
        eduLevel: [
          {
            // required: true,
            message: "请选择文化程度！",
            trigger: ["change", "blur"]
          }
        ],
        qqAccount: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        wechatAccount: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        alipayAccount: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        vehicleInfo: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        emailAccount: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        religion: [
          {
            max: 20,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        homeInfo: [
          {
            max: 150,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        hobby: [
          {
            max: 150,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        health: [
          {
            max: 150,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ]
      },
      rules: {
        personType: [
          {
            required: true,
            message: "请选择人员类型",
            trigger: ["change", "blur"]
          }
        ],
        personName: [
          {
            max: 15,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        personLocalCode: [
          {
            // required: true,
            validator: () => {
              return !!this.layoutForm.personLocalCode.length;
            },
            message: "请选择籍贯！"
            // trigger: ["change", "blur"]
          }
        ],
        personGender: [
          {
            required: true,
            message: "请选择性别！",
            trigger: ["change", "blur"]
          }
        ],
        relationship: [],
        credType: [],
        credNum: [],
        credAddr: [
          {
            required: true,
            message: "请填写证件登记住址！",
            trigger: ["change", "blur"]
          },
          {
            max: 60,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        currentAddr: [
          {
            // required: true,
            message: "请填写现住址！",
            trigger: ["change", "blur"]
          },
          {
            max: 60,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        contactMobile: [
          {
            required: true,
            message: "请填写联系电话！",
            trigger: ["change", "blur"]
          }
          //   { pattern: this.Rules.phoneOrTel, message: "请输入正确的联系电话" }
        ],
        contactLine: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        personNative: [
          { max: 8, message: "您输入的内容过长！", trigger: ["change", "blur"] }
        ],
        politicsStatus: [
          {
            // required: true,
            message: "请选择政治面貌！",
            trigger: ["change", "blur"]
          }
        ],
        eduLevel: [
          {
            // required: true,
            message: "请选择文化程度！",
            trigger: ["change", "blur"]
          }
        ],
        qqAccount: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        wechatAccount: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        alipayAccount: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        vehicleInfo: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        emailAccount: [
          {
            max: 100,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        religion: [
          {
            max: 20,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        homeInfo: [
          {
            max: 150,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        hobby: [
          {
            max: 150,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ],
        health: [
          {
            max: 150,
            message: "您输入的内容过长！",
            trigger: ["change", "blur"]
          }
        ]
      }
    };
  },
  mounted() {},
  methods: {
    getPersonDetail() {
      this.$modal.showLoading("请稍候...");
      certificateService
        .getPersonInfodetail({ personUuid: this.personUuid })
        .then(res => {
          if (res.success) {
            let tmp = res.bean;
            Object.keys(this.layoutForm).forEach(key => {
              this.layoutForm[key] =
                tmp[key] == undefined ? this.layoutForm[key] : tmp[key];
            });
            console.log(this.layoutForm)
            debugger
            if(this.layoutForm.personType=='01'){
              this.isDisabled=true
              this.$refs.uForm.setRules(this.rules1);
            }
            console.log(this.layoutForm);
            this.isShow = false;
            //   let val = tmp.personLocalCode;

            //   if (val) {
            //     let lastAreaCode = Array.isArray(val) ? val.reverse()[0] : (val.includes(",") ? val.split(",").reverse()[0] : val);
            //     let selectArea = this.allAreas.filter(a => a.areaCode == lastAreaCode)[0];
            //     if (!selectArea) {
            //       this.layoutForm.personLocalCode = '';
            //     }
            //   }
            this.$modal.hideLoading();
            //   this.$refs.layoutForm.validate(() => {});
          } else {
            this.$message.error(res.msg);
          }
        })
        .finally(() => this.$modal.hideLoading());
    },
    // 类型名称回调事件
    selectTypeConfirm(e){
         this.layoutForm.personTypeName = e[0].label;
        this.layoutForm.personType = e[0].value;
    },
    showArea(type) {
      this.areaType = type;
      this.areaShow = true;
    },
    nativeNameSelectShowComfir(areas) {
      let str = "";
      if (this.$modal.isMuniCity(areas[0].proCode)) {
        str = [areas[0].admdivName, areas[0].countryName].join("");
      } else {
        str = [
          areas[0].proName,
          areas[0].admdivName,
          areas[0].countryName
        ].join("");
      }
      if (this.areaType == 1) {
        // 籍贯
        // this.layoutForm.personLocal = str;
        this.layoutForm.personLocal = areas[0].countryName;
        // this.layoutForm.personLocalCode = [
        //   areas[0].proCode,
        //   areas[0].admdivCode,
        //   areas[0].countryCode
        // ].join(",");
        this.layoutForm.personLocalCode = areas[0].countryCode;
        // this.layoutForm.nativeCountyCode = areas[0].countryCode;
      } else {
        // 经营地址
        this.layoutForm.personLocalCode = [
          areas[0].proCode,
          areas[0].admdivCode,
          areas[0].countryCode
        ];
        // .join(",");
        // this.layoutForm.personLocalCode = str;
        // this.layoutForm.busiProvCode = areas[0].proCode;
        // this.layoutForm.busiCityCode = areas[0].admdivCode;
        // this.layoutForm.busiCountyCode = areas[0].countryCode;
      }
      this.areaShow = false;
    },
    // 数据字典组件选择事件
    dicSelectOpen: function(keyWord) {
      if (this.dicKeyWords == keyWord && this.dicShow) {
        return true;
      }
      return false;
    },
    showDic: function(key, cur, fileName) {
      // if (!this.state.canEdit) return;
      if (this.dicShow) return;
      this.dicKeyWords = key;
      this.dicCurrentSelect = cur;
      this.dicShow = true;
    },
    clicDatekHandle(type) {
      this[type] = true;
    },
    changeDate(type, e) {
      this.layoutForm[type] = dateUtils.dateFormat(
        "yyyy-MM-dd",
        new Date(e.result)
      );
    },
    selectDicConfirm: function(e) {
      //L_PIC_CID_TYPE
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.L_PIC_CID_TYPE) {
        this.layoutForm.credTypeName = e[0].label;
        this.layoutForm.credType = e[0].extra.bcbCode;
      }
      //L_PERSON_TYPE
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.L_PERSON_TYPE) {
        this.layoutForm.personTypeName = e[0].label;
        this.layoutForm.personType = e[0].extra.bcbCode;
      }
      //L_RELATIONSHIP
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.L_RELATIONSHIP) {
        this.layoutForm.relationshipName = e[0].label;
        this.layoutForm.relationship = e[0].extra.bcbCode;
      }
      //BSC_GENDDER
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.BSC_GENDDER) {
        this.layoutForm.personGenderName = e[0].label;
        this.layoutForm.personGender = e[0].extra.bcbCode;
      }
      //T_PERSON_POLITICS
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.T_PERSON_POLITICS) {
        this.layoutForm.politicsStatusName = e[0].label;
        this.layoutForm.politicsStatus = e[0].extra.bcbCode;
      }
      //L_EDU_LEVEL
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.L_EDU_LEVEL) {
        this.layoutForm.eduLevelName = e[0].label;
        this.layoutForm.eduLevel = e[0].extra.bcbCode;
      }
      //NATION_LIST
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.NATION_LIST) {
        this.layoutForm.personNativeName = e[0].label;
        this.layoutForm.personNative = e[0].extra.bcbCode;
      }
    },
    clicDatekHandle(type) {
      this[type] = true;
    },
    changeDate(type, e) {
      this.layoutForm[type] = dateUtils.dateFormat(
        "yyyy-MM-dd",
        new Date(e.result)
      );
    },
    peopleTypeShow(){
      this.typeShow = true
    },
    submitLngLat() {
      console.log(this.layoutForm);
      this.$refs.uForm.validate(valid => {
        if (valid) {
          if (this.personUuid) {
            certificateService
              .updatePerson({
                ...this.layoutForm
              })
              .then(res => {
                if (res.success) {
                  // this.$u.success('采集成功', 200, () => {
                  //     that.backPrev({
                  //         paramKey: "params",
                  //         param: {},
                  //     });
                  // });
                  // this.$u.toast("保存成功");
                  this.backPrev({
                    paramKey: "SaveRefreshPeople",
                    param: {}
                  });
                } else {
                  this.$u.toast(res.msg);
                }
              })
              .catch(e => {
                this.$u.toast(e);
              });
          } else {
            certificateService
              .savePerson({
                ...this.layoutForm
              })
              .then(res => {
                if (res.success) {
                  // this.$u.success('采集成功', 200, () => {
                  //     that.backPrev({
                  //         paramKey: "params",
                  //         param: {},
                  //     });
                  // });
                  // this.$u.toast("保存成功");
                  this.backPrev({
                    paramKey: "SaveRefreshPeople",
                    param: {}
                  });
                } else {
                  this.$u.toast(res.msg);
                }
              })
              .catch(e => {
                this.$u.toast(e);
              });
          }
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
@import "./retailItem.scss";
.page {
  padding: 0;
  //   display: flex;
  //   justify-content: center;
}
.popup-submit-btns {
  width: calc(100% - 30px);
  position: fixed;
  bottom: 10rpx;
}
.rdcontent {
  padding-bottom: 100px;
}
</style>
